#ifndef PIECE_HPP
#define PIECE_HPP

#include <list>
#include "Chess.hpp"
#include "Position.hpp"

using namespace std;

class Cell;

class Piece
{
	public:
	
		typedef enum { PAWN = 0, ROOK, KNIGHT, BISHOP, QUEEN, KING } Type;
		
		virtual ~Piece();
		
		virtual list<Position*>		getPossibleCases() const = 0;
		
		Chess::Color 				getColor() const;
		virtual Piece::Type			getType() const;
		bool						isOut() const;
		void						setOut();
		void						setCell(Cell* c);
		Cell*						getCell() const;
		void						incrNbMovements();
		unsigned int				getNbMovements() const;
		void						setNbMovements(unsigned int val);
		
	protected:
		static void left_horizontal(const Piece& p, list<Position*>& valables);
		static void right_horizontal(const Piece& p, list<Position*>& valables);
		static void up_vertical(const Piece& p, list<Position*>& valables);
		static void down_vertical(const Piece& p, list<Position*>& valables);
		
		static void up_left_diagonal(const Piece& p, list<Position*>& valables);
		static void up_right_diagonal(const Piece& p, list<Position*>& valables);
		static void down_left_diagonal(const Piece& p, list<Position*>& valables);
		static void down_right_diagonal(const Piece& p, list<Position*>& valables);
		
		Piece(Chess::Color color, Piece::Type type, const Position& pos);
		
		Chess::Color 	color;
		Piece::Type		type;
		Cell*			cell;
		unsigned int	nb_movements;
};

#endif
